#pragma once
#include "Sprite.h"
#include "Global.h"
#include "GameTime.h"
#include "Explode.h"
#include "Collision.h"

class CObject
{
protected:
	Sprite *m_Sprite; // con tro luu anh
	int m_IdImage; // loai hinh anh se duoc draw

	IDStatus m_Status; // chua dung toi

	D3DXVECTOR2 m_Position; // toa do cua sprite tren map
	SpriteEffect m_Flip; // co lat hinh hay khong
	D3DXVECTOR2 m_Scale; // thong so lat hinh (1.0f, 1.0f) = khong flip, (-1.0f, 1.0f) = flip

	Box m_Box;
	//bool m_Draw; 
	//bool m_IsJump;
	bool m_IsEffect; // hieu ung khi nhan vat hay quai die
	bool m_IsCollision;

	float m_Veclocity_vx;
	float m_Veclocity_vy;
	float m_TimeAnimation; // thoi gian de update su chuyen dong cua sprite

	GameTime *m_Gametime;
	int m_Vpx, m_Vpy; // thong so cua camera

	Explode *m_Explode;// hieu ung khi chet
	Collision *m_CheckCollision;
public:
	CObject();
	virtual void Update()
	{};
	virtual void Draw(LPD3DXSPRITE SpriteHandler);
	float getVeclocity_vx()
	{
		return m_Veclocity_vx;
	}
	void setVeclocity_vx(float vx)
	{
		m_Veclocity_vx = vx;
	}
	void setVeclocity_vy(float vy)
	{
		m_Veclocity_vy = vy;
	}
	float getVeclocity_vy()
	{
		return m_Veclocity_vy;
	}
	void setPosition_X(float x)
	{
		m_Position.x = x;
	}
	void setPosition_Y(float y)
	{
		m_Position.y = y;
	}
	float getPosition_X()
	{
		return m_Position.x;
	}
	float getPosition_Y()
	{
		return m_Position.y;
	}

	void setBox(Box temp)
	{
		m_Box = temp;
	}

	int getHeight()
	{
		return m_Sprite->getHeight();
	}

	int getWidth()
	{
		return m_Sprite->getWidth();
	}
	bool isCollision(CObject *object);
	IDStatus getStatus()
	{
		return m_Status;
	}

	void setCamera(int Vpx, int Vpy)
	{
		m_Vpx = Vpx;
		m_Vpy = Vpy;
	}

	void setIDStatus(IDStatus status)
	{
		m_Status = status;
	}

	Box getBox()
	{
		return m_Box;
	}

	Box getBouding()
	{
		return Box(m_Position.x, m_Position.y, m_Sprite->getWidth(), m_Sprite->getHeight(), m_Veclocity_vx, m_Veclocity_vy);
	}

	int getVpx()
	{
		return m_Vpx;
	}

	virtual void UpdateVeclocity(){};

	virtual ~CObject();
};